package com.xunyin.netty;


import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import io.netty.channel.ChannelHandlerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.concurrent.TimeUnit;

/**
 * @author jthong
 * @Description 缓存帮助类
 * @Version 1.0.0
 * @Date 2019/12/26 16:18
 */
public class EntityCacheHelp {
    private static final Logger LOGGER = LoggerFactory.getLogger(EntityCacheHelp.class);

    public static Cache<String, ChannelHandlerContext> channelIdCache = CacheBuilder
            .newBuilder()
            .maximumSize(9999)
            .expireAfterAccess(365, TimeUnit.DAYS)
            .build();

    public static Cache<String, ChannelHandlerContext> channelMacCache = CacheBuilder
            .newBuilder()
            .maximumSize(9999)
            .expireAfterAccess(365, TimeUnit.DAYS)
            .build();

    public static Cache<String, String> channelMacToIdCache = CacheBuilder
            .newBuilder()
            .maximumSize(99999)
            .expireAfterAccess(365, TimeUnit.DAYS)
            .build();

    public static boolean arrayEquals(String[] a, String[] b) {
        return Arrays.equals(a, b);
    }

//    public static String[] getItemVosByIndicex(List<ItemVO> itemVos){
//        Set<String> set = new HashSet<>();
//        return set.toArray(new String[set.size()]);
//    }

}